
import { legacy_createStore as createStore, applyMiddleware } from 'redux'

import app from './modules/app'
import pro from './modules/pro'

// createSagaMiddleware 是用来创建 saga 中间件的方法
import createSagaMiddleware from 'redux-saga'

import mySaga from './mySaga'

// 合并多个 reducer 的方法
import {combineReducers} from 'redux-immutable'


// 创建 saga 中间件
const sagaMiddleware = createSagaMiddleware()

const reducer = combineReducers({
    app,pro
})

// applyMiddleware(sagaMiddleware)  应用 saga 中间件
const store = createStore(reducer, applyMiddleware(sagaMiddleware))

// 使 saga 中的一部操作生效
sagaMiddleware.run(mySaga)

export default store